package com.jymj.controller;

import com.jymj.entity.GfEntity;
import com.jymj.entity.fhtnty.GfFhEntity;
import com.jymj.entity.fhtnty.MlxcFhEntity;
import com.jymj.service.GfService;
import com.jymj.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by dl on 2019/5/17.
 */
@Controller
@RequestMapping("gf")
public class GfController {

    @Autowired
    private GfService gfService;

    /*
    * 市政公服 -- 基础设施
    * */
    @RequestMapping("/gfList/{pjid}")
    @ResponseBody
    public R gfList(@PathVariable("pjid") Integer pjid) {
        List<GfFhEntity> gfEntities = gfService.queryByTzlx(pjid);
        return R.ok().put("data", gfEntities);
    }

    @RequestMapping("/gfGeom")
    @ResponseBody
    public R gfGeom(String name, Integer pjid) {
        List<GfEntity> gfEntities = gfService.selectByName(name, pjid);
        return R.ok().put("data", gfEntities);
    }

    @RequestMapping("/queryMlxc")
    @ResponseBody
    public R queryMlxc(String code,Integer type){
        List<MlxcFhEntity> mlxcFhEntities = gfService.queryMlxc(code,type);
        return R.ok().put("data",mlxcFhEntities);
    }


    /*
    * 查询人居环境空地块
    * */
    @RequestMapping("/queryKdk")
    public R queryKdk(){
        List<MlxcFhEntity> mlxcFhEntities = gfService.queryKdk();
        return R.ok().put("data",mlxcFhEntities);

    }
}
